/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * EditMemberInformationPanel.java
 *
 * Created on Jul 12, 2011, 5:38:05 PM
 */
package panels;

import conn.EMIS4Connection;
import constants.Constants;
import dao.PersonDao;
import dao.SexDao;
import dao.LoginDao;
import dao.UpdateHistoryDao;
import exec.NotFoundException;
import java.sql.Date;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import main.MainFrame;
import obj.Login;
import obj.Person;
import obj.Sex;
import obj.UpdateHistory;
import util.DashboardUtil;
import util.EMISUtil;
import util.LoggedInUser;
import util.PersonRequested;
import verification.*;

/**
 *
 * @author nknowles
 */
public class PatientPersonalInformationPanel extends javax.swing.JPanel implements WantsValidationStatus {

  private boolean success;
  private PersonRequested pr = PersonRequested.getInstance();
  private EMIS4Connection conn = EMIS4Connection.getInstance();
  private UpdateHistory history;
  private UpdateHistoryDao historyDAO;
  private int userID;
  private List<Sex> sexList;
  private Person person;
  private PersonDao personDAO;
  private SexDao sexDAO;
  private Login login;
  private LoginDao loginDAO;

  /** Creates new form EditMemberInformationPanel */
  public PatientPersonalInformationPanel() {
    initComponents();
    history = new UpdateHistory();
    historyDAO = new UpdateHistoryDao();
    person = new Person();
    personDAO = new PersonDao();
    sexDAO = new SexDao();
    login = new Login();
    loginDAO = new LoginDao();

    fillInformation();
    success = false;

    firstNameTextField.setInputVerifier(new TextFieldVerifier(this, firstNameTextField, "First name cannont be blank", Constants.FIRST_NAME_LENGTH_MIN, Constants.FIRST_NAME_LENGTH_MAX));
    lastNameTextField.setInputVerifier(new TextFieldVerifier(this, lastNameTextField, "Last name cannot be blank", Constants.LAST_NAME_LENGTH_MIN, Constants.LAST_NAME_LENGTH_MAX));
    emailTextField.setInputVerifier(new EmailFieldVerifier(this, emailTextField, "Email cannot be left blank", Constants.EMAIL_LENGTH_MIN, Constants.EMAIL_LENGTH_MAX));
    dobTextField.setInputVerifier(new DateFieldVerifier(this, dobTextField, "Date of Birth cannont be left blank", Constants.DOB_LENGTH));
    ssnTextField.setInputVerifier(new SsnFieldVerifier(this, ssnTextField, "SSN cannont be left blank", Constants.SSN_LENGTH));
  }

  private void fillInformation() {
    if (pr.getPerson() == null) {
      DashboardUtil.searchForPatient();
    }
    person = pr.getPerson();
    userID = person.getPersonID();

    try {
      // get info from database
      conn.connect();
      login = loginDAO.getObject(conn.getConnection(), userID);
      person = personDAO.getObject(conn.getConnection(), userID);
      sexList = sexDAO.loadAll(conn.getConnection());
    } catch (NotFoundException ex) {
      Logger.getLogger(PatientPersonalInformationPanel.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SQLException ex) {
      Logger.getLogger(RegisterPanel.class.getName()).log(Level.SEVERE, null, ex);
    }

    // fill out combo boxes    
    for (Sex sexItem : sexList) {
      sexComboBox.addItem(sexItem.getName());
    }

    // fill out info
    firstNameTextField.setText(person.getFirstName());
    lastNameTextField.setText(person.getLastName());
    dobTextField.setText(person.getDOB().toString().substring(0, 10));
    ssnTextField.setText(EMISUtil.convertSsnString(person.getSSN()));
    emailTextField.setText(person.getEmail());
    sexComboBox.setSelectedIndex(person.getSexID());
    if (person.getMaritalStatus() == null) {
      mariedComboBox.setSelectedIndex(0);
    } else {
      mariedComboBox.setSelectedItem(person.getMaritalStatus());
    }
    if (person.getBloodType() == null) {
      bloodTypeComboBox.setSelectedIndex(0);
    } else {
      bloodTypeComboBox.setSelectedItem(person.getBloodType());
    }

    if (LoggedInUser.getInstance().getRoleID() != 5) {
      lockedCheckBox.setEnabled(false);
    } else {
      if (login.getLocked() == false) {
        lockedCheckBox.setSelected(false);
      } else {
        lockedCheckBox.setSelected(true);
      }
    }
  }

  private void popupWarning(String msg) {
    warningLabel.setText(msg);
    warningDialog.pack();
    warningDialog.setLocationRelativeTo(MainFrame.getInstance());
    warningDialog.setVisible(true);
  }

  /**
   * This is called whenever a text field is validated (the field loses focus)
   * @return True if all are valid, False otherwise.
   */
  private boolean checkAll() {
    boolean valid = true;

    if (firstNameTextField.getText().isEmpty()) {
      valid = false;
    } else {
      // Capitalize first letter
      char[] temp = firstNameTextField.getText().toCharArray();
      temp[0] = Character.toUpperCase(temp[0]);
      firstNameTextField.setText(String.valueOf(temp));
    }
    if (lastNameTextField.getText().isEmpty()) {
      valid = false;
    } else {
      // Capitalize first letter
      char[] temp = lastNameTextField.getText().toCharArray();
      temp[0] = Character.toUpperCase(temp[0]);
      lastNameTextField.setText(String.valueOf(temp));
    }
    if (emailTextField.getText().isEmpty()) {
      valid = false;
    }
    if (dobTextField.getText().replaceAll("[^0-9]", "").isEmpty()) {
      valid = false;
    }
    if (ssnTextField.getText().replaceAll("[^0-9]", "").isEmpty()) {
      valid = false;
    }
    return valid;
  }

  /** This method is called from within the constructor to
   * initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is
   * always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    warningDialog = new javax.swing.JDialog();
    warningLabel = new javax.swing.JLabel();
    okButton = new javax.swing.JButton();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    jLabel9 = new javax.swing.JLabel();
    jLabel12 = new javax.swing.JLabel();
    jLabel13 = new javax.swing.JLabel();
    firstNameTextField = new javax.swing.JTextField();
    lastNameTextField = new javax.swing.JTextField();
    dobTextField = new javax.swing.JFormattedTextField();
    ssnTextField = new javax.swing.JFormattedTextField();
    emailTextField = new javax.swing.JTextField();
    sexComboBox = new javax.swing.JComboBox();
    mariedComboBox = new javax.swing.JComboBox();
    bloodTypeComboBox = new javax.swing.JComboBox();
    submitButton = new javax.swing.JButton();
    lockedCheckBox = new javax.swing.JCheckBox();
    jLabel7 = new javax.swing.JLabel();

    warningDialog.setTitle("Warning!");
    warningDialog.setAlwaysOnTop(true);
    warningDialog.setName("warningDialog"); // NOI18N
    warningDialog.getContentPane().setLayout(new java.awt.GridBagLayout());

    warningLabel.setText("message");
    warningLabel.setName("warningLabel"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.insets = new java.awt.Insets(10, 15, 10, 15);
    warningDialog.getContentPane().add(warningLabel, gridBagConstraints);

    okButton.setText("OK");
    okButton.setName("okButton"); // NOI18N
    okButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        okButtonActionPerformed(evt);
      }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
    warningDialog.getContentPane().add(okButton, gridBagConstraints);

    setBackground(new java.awt.Color(220, 220, 210));
    setLayout(new java.awt.GridBagLayout());

    jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24));
    jLabel1.setText("Personal Information");
    jLabel1.setName("jLabel1"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(20, 15, 0, 15);
    add(jLabel1, gridBagConstraints);

    jLabel2.setText("First Name:"); // NOI18N
    jLabel2.setName("jLabel2"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 25, 0, 0);
    add(jLabel2, gridBagConstraints);

    jLabel3.setText("Last Name:");
    jLabel3.setName("jLabel3"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 25, 0, 0);
    add(jLabel3, gridBagConstraints);

    jLabel4.setText("DOB:");
    jLabel4.setName("jLabel4"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 25, 0, 0);
    add(jLabel4, gridBagConstraints);

    jLabel5.setText("SSN:");
    jLabel5.setName("jLabel5"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 25, 0, 0);
    add(jLabel5, gridBagConstraints);

    jLabel6.setText("Email:");
    jLabel6.setName("jLabel6"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 25, 0, 0);
    add(jLabel6, gridBagConstraints);

    jLabel9.setText("Sex:");
    jLabel9.setName("jLabel9"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 25, 0, 0);
    add(jLabel9, gridBagConstraints);

    jLabel12.setText("Martial Status:");
    jLabel12.setName("jLabel12"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 7;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 25, 0, 0);
    add(jLabel12, gridBagConstraints);

    jLabel13.setText("Blood Type:");
    jLabel13.setName("jLabel13"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 8;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 25, 0, 0);
    add(jLabel13, gridBagConstraints);

    firstNameTextField.setName("firstNameTextField"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 5, 0, 15);
    add(firstNameTextField, gridBagConstraints);

    lastNameTextField.setName("lastNameTextField"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 5, 0, 15);
    add(lastNameTextField, gridBagConstraints);

    try {
      dobTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("####-##-##")));
    } catch (java.text.ParseException ex) {
      ex.printStackTrace();
    }
    dobTextField.setName("dobTextField"); // NOI18N
    dobTextField.setNextFocusableComponent(ssnTextField);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 5, 0, 15);
    add(dobTextField, gridBagConstraints);

    try {
      ssnTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###-##-####")));
    } catch (java.text.ParseException ex) {
      ex.printStackTrace();
    }
    ssnTextField.setName("ssnTextField"); // NOI18N
    ssnTextField.setNextFocusableComponent(emailTextField);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 5, 0, 15);
    add(ssnTextField, gridBagConstraints);

    emailTextField.setName("emailTextField"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 5, 0, 15);
    add(emailTextField, gridBagConstraints);

    sexComboBox.setName("sexComboBox"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.ipady = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 5, 0, 15);
    add(sexComboBox, gridBagConstraints);

    mariedComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " ", "Single", "Married", "Widowed", "Divorced", "Seperated" }));
    mariedComboBox.setName("mariedComboBox"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 7;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 5, 0, 15);
    add(mariedComboBox, gridBagConstraints);

    bloodTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " ", "O+", "A+", "B+", "AB+", "O-", "A-", "B-", "AB-" }));
    bloodTypeComboBox.setName("bloodTypeComboBox"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 8;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 5, 0, 15);
    add(bloodTypeComboBox, gridBagConstraints);

    submitButton.setText("Submit");
    submitButton.setName("submitButton"); // NOI18N
    submitButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        submitButtonActionPerformed(evt);
      }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 10;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 0.1;
    gridBagConstraints.weighty = 0.1;
    gridBagConstraints.insets = new java.awt.Insets(6, 5, 10, 15);
    add(submitButton, gridBagConstraints);

    lockedCheckBox.setName("lockedCheckBox"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 9;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 5, 0, 15);
    add(lockedCheckBox, gridBagConstraints);

    jLabel7.setText("Locked:");
    jLabel7.setName("jLabel7"); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 9;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(10, 25, 0, 0);
    add(jLabel7, gridBagConstraints);
  }// </editor-fold>//GEN-END:initComponents

  private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitButtonActionPerformed
    Date newDate, oldDate;
    int newNum, oldNum;
    String newString, oldString;
    conn.connect();

    try {
      // check first name
      newString = firstNameTextField.getText();
      oldString = person.getFirstName();
      if (!(newString.equals(oldString))) {
        person.setFirstName(newString);
        history.setAll("Person", userID, "First_Name", "Update first name", oldString, newString);
        historyDAO.create(conn.getConnection(), history);
      }

      // check last name
      newString = lastNameTextField.getText();
      oldString = person.getLastName();
      if (!(newString.equals(oldString))) {
        person.setLastName(newString);
        history.setAll("Person", userID, "Last_Name", "Update last name", oldString, newString);
        historyDAO.create(conn.getConnection(), history);
      }

      // check DOB
      newDate = util.DateUtils.makeSqlDate(dobTextField.getText());
      oldDate = person.getDOB();
      if (!(newDate.equals(person.getDOB()))) {
        person.setDOB(newDate);
        history.setAll("Person", userID, "DOB", "Update DOB", oldDate.toString(), newDate.toString());
        historyDAO.create(conn.getConnection(), history);
      }

      // check SSN
      newNum = Integer.valueOf(ssnTextField.getText().replaceAll("[^0-9]", ""));
      oldNum = person.getSSN();
      if (newNum != oldNum) {
        person.setSSN(newNum);
        history.setAll("Person", userID, "SSN", "Update SSN", String.valueOf(oldNum), String.valueOf(newNum));
        historyDAO.create(conn.getConnection(), history);
      }

      // check email
      newString = emailTextField.getText();
      oldString = person.getEmail();
      if (!(newString.equals(oldString))) {
        person.setEmail(newString);
        history.setAll("Person", userID, "Email", "Update email", oldString, newString);
        historyDAO.create(conn.getConnection(), history);
      }

      // check sex
      newNum = sexComboBox.getSelectedIndex();
      oldNum = person.getSexID();
      if (newNum != oldNum) {
        person.setSexID(newNum);
        history.setAll("Person", userID, "Sex_ID", "Update Sex ID", String.valueOf(oldNum), String.valueOf(newNum));
        historyDAO.create(conn.getConnection(), history);
      }

      // check martial status
      newString = mariedComboBox.getSelectedItem().toString();
      oldString = person.getMaritalStatus();
      if (oldString != null && !(newString.equals(oldString))) {
        person.setMaritalStatus(newString);
        history.setAll("Person", userID, "Martial_Status", "Update martial status", oldString, newString);
        historyDAO.create(conn.getConnection(), history);
      } else if (oldString == null && newString.length() > 0) {
        person.setMaritalStatus(newString);
        history.setAll("Person", userID, "Martial_Status", "Update martial status", "", newString);
        historyDAO.create(conn.getConnection(), history);
      }

      // check blood type
      newString = bloodTypeComboBox.getSelectedItem().toString();
      oldString = person.getBloodType();
      if (oldString != null && !(newString.equals(oldString))) {
        person.setBloodType(newString);
        history.setAll("Person", userID, "Blood_Type", "Update blood type", oldString, newString);
        historyDAO.create(conn.getConnection(), history);
      } else if (oldString == null && newString.length() > 0) {
        person.setBloodType(newString);
        history.setAll("Person", userID, "Blood_Type", "Update blood type", "", newString);
        historyDAO.create(conn.getConnection(), history);
      }

      //Check Locked
      if (lockedCheckBox.isSelected() == false) {
        login.setLocked(false);
        history.setAll("Login", userID, "Locked", "Account UNLOCKED", "1", "0");
        historyDAO.create(conn.getConnection(), history);
      } else {
        history.setAll("Login", userID, "Locked", "Account LOCKED", "0", "1");
        historyDAO.create(conn.getConnection(), history);
        login.setLocked(true);
      }

      // update database
      personDAO.save(conn.getConnection(), person);
      loginDAO.save(conn.getConnection(), login);

      // popup message
      warningDialog.setTitle("Success!");
      popupWarning("Update was successfull!");
      success = true;
    } catch (SQLException ex) {
      Logger.getLogger(PatientPersonalInformationPanel.class.getName()).log(Level.SEVERE, null, ex);
    } catch (NotFoundException ex) {
      Logger.getLogger(PatientPersonalInformationPanel.class.getName()).log(Level.SEVERE, null, ex);
    }
  }//GEN-LAST:event_submitButtonActionPerformed

  private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
    warningDialog.setVisible(false);
  }//GEN-LAST:event_okButtonActionPerformed
  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JComboBox bloodTypeComboBox;
  private javax.swing.JFormattedTextField dobTextField;
  private javax.swing.JTextField emailTextField;
  private javax.swing.JTextField firstNameTextField;
  private javax.swing.JLabel jLabel1;
  private javax.swing.JLabel jLabel12;
  private javax.swing.JLabel jLabel13;
  private javax.swing.JLabel jLabel2;
  private javax.swing.JLabel jLabel3;
  private javax.swing.JLabel jLabel4;
  private javax.swing.JLabel jLabel5;
  private javax.swing.JLabel jLabel6;
  private javax.swing.JLabel jLabel7;
  private javax.swing.JLabel jLabel9;
  private javax.swing.JTextField lastNameTextField;
  private javax.swing.JCheckBox lockedCheckBox;
  private javax.swing.JComboBox mariedComboBox;
  private javax.swing.JButton okButton;
  private javax.swing.JComboBox sexComboBox;
  private javax.swing.JFormattedTextField ssnTextField;
  private javax.swing.JButton submitButton;
  private javax.swing.JDialog warningDialog;
  private javax.swing.JLabel warningLabel;
  // End of variables declaration//GEN-END:variables

  @Override
  public void validateFailed() {
    submitButton.setEnabled(false);
  }

  @Override
  public void validatePassed() {
    if (checkAll()) {
      submitButton.setEnabled(true);
    }
  }
}
